package com.woniu.controller;


import cn.dev33.satoken.util.SaResult;
import com.woniu.entity.VaTask;
import com.woniu.entity.dto.VaResultDTO;
import com.woniu.entity.dto.VaResultParticularsDTO;
import com.woniu.service.EvaluatTaskResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("evaluatTaskResult")
public class EvaluatTaskResultCntroller {
    @Autowired
    private EvaluatTaskResultService evaluatTaskResultService;
    //查询全部的作业
    @GetMapping("/findAllTask")
    public SaResult findAllTask() {
        List<VaTask> allTask = evaluatTaskResultService.findAllTask();
        return SaResult.ok().setData(allTask);
    }
    //所有作业结果
    @GetMapping("/findAllTaskResult/{taskId}")
        public SaResult findAllTaskResult(@PathVariable Integer taskId) {
        List<VaResultDTO> allTaskResult = evaluatTaskResultService.findAllTaskResult(taskId);
        return SaResult.ok().setData(allTaskResult);
    }
    //通过作业结果id查询作业详情
    @GetMapping("/findTaskResultParticulars/{resultId}")
        public SaResult findTaskResultParticulars(@PathVariable Integer resultId) {
            VaResultParticularsDTO taskResultParticulars = evaluatTaskResultService.findTaskResultParticulars(resultId);
            return SaResult.ok().setData(taskResultParticulars);
        }



}
